package com.iflytek.cosmo.ocr.support.mq;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Destination;

/**
 * 消息 Provider
 * @author yunsun
 *
 */
@Component
public class Provider {
	
	/**
	 * JmsMessagingTemplate
	 */
	@Autowired
	private JmsMessagingTemplate jmsMessagingTemplate;
	
	/**
	 * 发送消息
	 * @param queueName 队列名
	 * @param message 消息内容
	 */
	public void send(String queueName, String message) {
		// 这里定义了destination
		Destination destination = new ActiveMQQueue(queueName);
		this.jmsMessagingTemplate.convertAndSend(destination, message);
	}
}
